<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>getUnicode</title>
</head>

<body>
    <script>
        const getUnicode = text => {
            if (text && text.indexOf('\\u') !== -1) {
                let textArr = text.split('\\u'),
                    result = '';
                for (let j = 0, length = textArr.length; j < length; j++) {
                    result += String.fromCharCode(parseInt(textArr[j], 16));
                }
                return result.slice(1);
            } else {
                return text;
            }
        };
        document.write(getUnicode(`\\u48\\u65\\u6c\\u6c\\u6f\\u2c\\u77\\u6f\\u72\\u6c\\u64\\u21`)); // 'Hello,world!'
    </script>
</body>

</html>